home *** CD-ROM | disk | FTP | other *** search
- /* graphics libraries:
- layout library interface: Line Layout support routines
- by Dave Opstad, Eric Mader
- Copyright 1990 - 1993 Apple Computer, Inc. All rights reserved. */
-
- #pragma once
- #ifndef layoutLibraryIncludes
- #define layoutLibraryIncludes
-
- #ifndef graphicsRoutinesIncludes
- #include "graphics routines.h"
- #endif
-
- #ifndef layoutTypesIncludes
- #include "layout types.h"
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- struct StyleRunOverrides {
- gxPriorityJustificationOverride *priorityJustOverride;
- gxGlyphJustificationOverride *glyphJustOverrides;
- long glyphJustOverridesCount;
- gxGlyphSubstitution *glyphSubstitutions;
- long glyphSubstitutionsCount;
- gxKerningAdjustment *kerningAdjustments;
- long kerningAdjustmentsCount;
- };
-
- struct ParagraphRecord {
- short nLayouts;
- Fixed totalHeight;
- gxShape layouts[gxAnyNumber];
- };
-
- typedef struct ParagraphRecord** ParagraphRecordHandle;
-
- struct RunFeatureTypeName {
- gxRunFeatureType featureType;
- unsigned short nSelectors;
- unsigned short selectorTableOffset;
- short nameIndex;
- };
-
- struct RunFeatureSelectorName {
- gxRunFeatureSelector featureSelector;
- short nameIndex;
- };
-
- #ifndef __cplusplus
- typedef struct StyleRunOverrides StyleRunOverrides;
- typedef struct ParagraphRecord ParagraphRecord;
- typedef struct RunFeatureTypeName RunFeatureTypeName;
- typedef struct RunFeatureSelectorName RunFeatureSelectorName;
- #endif
-
- void InitializeRunControls (gxRunControls *runControls);
-
- void InitializeLayoutOptions (gxLayoutOptions *layoutOptions);
-
- void InitializeStyleRunOverrides (StyleRunOverrides *overrides);
-
- void SetDefaultPriorityJustOverride (gxPriorityJustificationOverride *override);
-
- void SetLayoutStyle (
- gxStyle s,
- char *gxFontName,
- Fixed textSize,
- gxTextAttribute attr,
- gxRunControls *runControls,
- gxRunFeature runFeatures[],
- long runFeaturesCount,
- StyleRunOverrides *overrides);
-
- gxStyle NewLayoutStyle (
- char *gxFontName,
- Fixed textSize,
- gxTextAttribute attr,
- gxRunControls *runControls,
- gxRunFeature runFeatures[],
- long runFeaturesCount,
- StyleRunOverrides *overrides);
-
- gxShape NewSingleLayout (
- char *text,
- char *gxFontName,
- Fixed textSize,
- gxLayoutOptions *options,
- gxPoint *position,
- gxTextAttribute attr,
- gxRunControls *runControls,
- gxRunFeature runFeatures[],
- long runFeaturesCount,
- StyleRunOverrides *overrides);
-
- /* The following functions provide a limited paragraph-creation function. They make calls
- to GetWidthArray and do simple gxLine-breaking using the obtained widths.
-
- !!! IMPORTANT NOTE FOLLOWS !!!
-
- These functions need to be able to deal with text in multiple scripts, which might
- contain zero bytes. Therefore calls that determine hard stops (such as NewParagraph)
- do NOT stop at zero bytes; this means that just passing in a single C string is NOT
- sufficient! Callers will need to add a carriage return themselves to the end of the
- text source. */
-
- ParagraphRecordHandle NewParagraph(
- char *text,
- gxStyle baseStyle,
- Fixed width,
- long justified, /* really a boolean; this way for compiler difference reasons */
- Fixed lineHeight, /* if zero, we will deduce */
- gxPoint *firstOrigin); /* origin of first gxLine in paragraph */
-
- ParagraphRecordHandle NewStyledParagraph(
- long textRunCount,
- const void *text[],
- const short textRunLengths[],
- long styleRunCount,
- const gxStyle styles[],
- const short styleRunLengths[],
- long levelRunCount,
- const short levels[],
- const short levelRunLengths[],
- long totalByteCount,
- const gxLayoutOptions *layoutOptions,
- Fixed lineHeight,
- const gxPoint *firstOrigin);
-
- void DisposeParagraph(ParagraphRecordHandle paraRec);
-
- /* GetLayoutBounds can be used to return the bounds of a layout. */
-
- gxShape GetLayoutBounds(gxShape layout);
-
- #ifdef __cplusplus
- }
- #endif
- #endif
-